package cn.iocoder.yudao.module.project.dal.mysql.kismaterialreceipt;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.kismaterialreceipt.KisMaterialReceiptDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.kismaterialreceipt.vo.*;

/**
 * 物料入库单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface KisMaterialReceiptMapper extends BaseMapperX<KisMaterialReceiptDO> {

    default PageResult<KisMaterialReceiptDO> selectPage(KisMaterialReceiptPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KisMaterialReceiptDO>()
                .betweenIfPresent(KisMaterialReceiptDO::getReceiptDate, reqVO.getReceiptDate())
                .eqIfPresent(KisMaterialReceiptDO::getSupplier, reqVO.getSupplier())
                .eqIfPresent(KisMaterialReceiptDO::getAuditMark, reqVO.getAuditMark())
                .eqIfPresent(KisMaterialReceiptDO::getCode, reqVO.getCode())
                .eqIfPresent(KisMaterialReceiptDO::getWarehouse, reqVO.getWarehouse())
                .eqIfPresent(KisMaterialReceiptDO::getMaterialCode, reqVO.getMaterialCode())
                .likeIfPresent(KisMaterialReceiptDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(KisMaterialReceiptDO::getSpecification, reqVO.getSpecification())
                .eqIfPresent(KisMaterialReceiptDO::getReceivableNum, reqVO.getReceivableNum())
                .eqIfPresent(KisMaterialReceiptDO::getActualNum, reqVO.getActualNum())
                .eqIfPresent(KisMaterialReceiptDO::getUnit, reqVO.getUnit())
                .eqIfPresent(KisMaterialReceiptDO::getMaterialNumber, reqVO.getMaterialNumber())
                .eqIfPresent(KisMaterialReceiptDO::getMaterialType, reqVO.getMaterialType())
                .eqIfPresent(KisMaterialReceiptDO::getDept, reqVO.getDept())
                .eqIfPresent(KisMaterialReceiptDO::getOperator, reqVO.getOperator())
                .eqIfPresent(KisMaterialReceiptDO::getBatchNumber, reqVO.getBatchNumber())
                .eqIfPresent(KisMaterialReceiptDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(KisMaterialReceiptDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(KisMaterialReceiptDO::getId));
    }




    void insertList(List<KisMaterialReceiptDO> insertList);

    // 根据开始结束时间查询入库报表
    List<MaterialReceiptReportVO> selectMaterialReceiptReportByDate(MaterialReceiptReportBO materialReceiptReportBO);

    Long countMaterialReceiptList(Map<String, Object> params);

    List<KisMaterialReceiptListVO> selectMaterialReceiptList(Map<String, Object> params);

}